<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>

<body>
<div id="myApp">
    <div v-bind:class="{active:isActive}">红色文本1</div>
    <div :class="{active:isActive}">红色文本2</div>
    <button @click="btnClick">改变class吧</button>
</div>
<script>
    var myApp = new Vue({
        el: '#myApp',
        data: {
            isActive: true,
        },
        methods: {
            btnClick: function(){
                this.isActive = !this.isActive;
            },
        },
    });
</script>
</body>

</html>